package com.Maykk.Demo08;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

/**
 * @ClassName: ReadFileShowToTCP
 * @Description: TODO 客户端 - 读取文件内容输出到控制台
 * @Author: MaykkStar@163.com
 */
public class ReadFileShowToTCP {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("127.0.0.1", 9527);
        OutputStream os = socket.getOutputStream();
        BufferedReader br = new BufferedReader(new FileReader("./TCP_IO.txt"));
        String line;
        while ((line = br.readLine()) != null) {
            os.write((line + "\n").getBytes());
        }

        socket.close();
    }
}
